<%-- 
    Document   : profile
    Created on : Dec 18, 2012, 9:43:24 AM
    Author     : gcastillo, nbenavidez
--%>

<%@ page import="com.almori.hr.timetracker.*" import="java.io.File"%>
 <%    
              TimeTrackerBean bean = new TimeTrackerBean();
              String I = request.getParameter("id");
              String L = request.getParameter("locked");
              
              int id = Integer.parseInt(I);
              Employee searchedEmpl = bean.getEmployee(id);
              
              Employee me = (Employee)session.getAttribute("Employee");    

              
                                                                                          
 %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title> <%= searchedEmpl.getfName() + " " + searchedEmpl.getlName()   %> </title>
        <link rel="Shortcut icon" href="img/logo.png" />
        <link rel="stylesheet" type="text/css" href="css/style_profile.css" />
          <!--[if IE 8]>
           <link rel="stylesheet" type="text/css" href="css/styleIE.css" />
        <![endif]-->
          <script language="javascript" type="text/javascript">
              window.onunload = function(){ 
                  window.opener.location.reload(); 
              }; 
              
          </script>
    </head>
    <body>
        <br />
        <form id="signup" action="accountunlock.jsp" method="GET">
           <div class="inputs">
               <% 
                    if(L != null)
                    {
                        if(searchedEmpl.getStatus() == "OUT")
                        {
                            bean.unlockAccount(searchedEmpl.getId());
                        }
                        else
                        {//error message
                        %>
                            
                         <style>
                             .clean-red{
                             border:solid 1px #DEDEDE; 
                             background:#FF0000;
                             color:#FFFFFF;
                             padding:4px;
                             text-align:center;
                             }
                         </style>
                         <div class="clean-red">ERROR: Cuenta no enllavada o estatus "En sistema"!</div>
                         <br /> 
                        <%
                        }
                           
                    }
                    else{}
               
                    
                    File f = new File(getServletContext().getRealPath("") + "\\img\\pics\\" + searchedEmpl.getPic());
                    String p = (f.exists()) ? searchedEmpl.getPic() : "auser.jpg";
                    
               %>
              
               <img src="img/pics/<%= p %>" alt="pic" height="110" width="100"></img>
               <br />
               <br />
               <table border='0'>
                  <tr>
                     <td style="text-align: left; overflow: hidden; width: 150px;position:static;">Nombre Completo </td>
                     <td style="text-align: left; overflow: hidden; width: 250px;"><strong><%=  searchedEmpl.getfName() + " " + searchedEmpl.getlName() %> </strong></td>
                  </tr>
               
                  <tr>
                     <td style="text-align: left; overflow: hidden; width: 150px;">Estatus </td>
                     <%
                          String temp = "";
                          if(searchedEmpl.getStatus() == "IN")
                          {
                               temp = "En Sistema";
                          }
                          else
                          {
                               temp = "Fuera de Sistema";
                          
                          }

                     %>
                     <td style="text-align: left; overflow: hidden; width: 250px;"><strong><%=  temp %></strong></td>
                  </tr>
               
                  <tr>
                     <td style="text-align: left; overflow: hidden; width: 150px;">No. de Cedula</td>
                     <td style="text-align: left; overflow: hidden; width: 250px;"><strong><%=  searchedEmpl.getCed() %></strong></td>
                  </tr>
               
                  
               </table>
               <br />
              
               <select id="combo" name="locked">==
                   <%
                        if(searchedEmpl.getLock()==0)
                        {
                   %>
                         <option value="0" selected="true">Estatus Normal</option>
                         <option value="1">Estatus a revisar</option>
                   <%
                        }else{
                   %>
                         <option value="0">Estatus Normal</option>
                         <option value="1" selected="true">Estatus a revisar</option>
                   
                   
                   <%
                        }
                   %>
               </select>
               <input type="hidden" value="<%= I %>" name="id" />
               <input type="submit" value="Guardar"></input>
          </div>
          </form>
         
    </body>
</html>
